package com.ruoyi.purchase.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.entity.SysUser;
import lombok.Data;

/**
 * 
 * @TableName po_purchase
 */
@TableName(value ="po_purchase")
@Data
public class Purchase extends BaseEntity implements Serializable {
    /**
     * 采购单编号=CG + 当前时间毫秒数
     */
    @TableId
    @Excel(name = "采购单编号")
    private String purId;

    /**
     * 序号
     */
    @TableField(exist = false)
    private Integer id;

    /**
     * 采购人id
     */
    private Integer sysCreateUserId;

    /**
     * 审核人id
     */
    private Integer sysCheckUserId;

    /**
     * 采购时间
     */
    @Excel(name = "采购时间",dateFormat ="yyyy-MM-dd HH:mm:ss")
    private Date purTime;

    /**
     * 审核时间
     */
    @Excel(name = "审核时间",dateFormat ="yyyy-MM-dd HH:mm:ss")
    private Date checkTime;

    /**
     * 审核意见
     */
    @Excel(name = "审核意见")
    private String opinion;

    /**
     * 仓库id
     */
    @Excel(name = "仓库id")
    private Integer repoWareId;

    /**
     * 0(未入库)1(入库)状态
     */
    @Excel(name = "入库状态",readConverterExp = "1=入库,0=未入库")
    private Integer rkState;

    /**
     * 总金额
     */
    @Excel(name = "总金额")
    private Double total;

    /**
     * 未审核1 审核中2
     */
    @Excel(name = "审核状态",readConverterExp = "1=未审核,2=审核中,3=审核通过,4=审核不通过")
    private String status;
    /**
     * 创建人
     */
    @Excel(name="创建人",targetAttr = "userName", type = Excel.Type.EXPORT)
    @TableField(exist = false)
    private SysUser sysUser;

    /**
     * 审核人
     */
    @Excel(name="审核人",targetAttr = "userName", type = Excel.Type.EXPORT)
    @TableField(exist = false)
    private SysUser sysUser1;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Purchase other = (Purchase) that;
        return (this.getPurId() == null ? other.getPurId() == null : this.getPurId().equals(other.getPurId()))
            && (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSysCreateUserId() == null ? other.getSysCreateUserId() == null : this.getSysCreateUserId().equals(other.getSysCreateUserId()))
            && (this.getSysCheckUserId() == null ? other.getSysCheckUserId() == null : this.getSysCheckUserId().equals(other.getSysCheckUserId()))
            && (this.getPurTime() == null ? other.getPurTime() == null : this.getPurTime().equals(other.getPurTime()))
            && (this.getCheckTime() == null ? other.getCheckTime() == null : this.getCheckTime().equals(other.getCheckTime()))
            && (this.getOpinion() == null ? other.getOpinion() == null : this.getOpinion().equals(other.getOpinion()))
            && (this.getRepoWareId() == null ? other.getRepoWareId() == null : this.getRepoWareId().equals(other.getRepoWareId()))
            && (this.getRkState() == null ? other.getRkState() == null : this.getRkState().equals(other.getRkState()))
            && (this.getTotal() == null ? other.getTotal() == null : this.getTotal().equals(other.getTotal()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPurId() == null) ? 0 : getPurId().hashCode());
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSysCreateUserId() == null) ? 0 : getSysCreateUserId().hashCode());
        result = prime * result + ((getSysCheckUserId() == null) ? 0 : getSysCheckUserId().hashCode());
        result = prime * result + ((getPurTime() == null) ? 0 : getPurTime().hashCode());
        result = prime * result + ((getCheckTime() == null) ? 0 : getCheckTime().hashCode());
        result = prime * result + ((getOpinion() == null) ? 0 : getOpinion().hashCode());
        result = prime * result + ((getRepoWareId() == null) ? 0 : getRepoWareId().hashCode());
        result = prime * result + ((getRkState() == null) ? 0 : getRkState().hashCode());
        result = prime * result + ((getTotal() == null) ? 0 : getTotal().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", purId=").append(purId);
        sb.append(", id=").append(id);
        sb.append(", sysCreateUserId=").append(sysCreateUserId);
        sb.append(", sysCheckUserId=").append(sysCheckUserId);
        sb.append(", purTime=").append(purTime);
        sb.append(", checkTime=").append(checkTime);
        sb.append(", opinion=").append(opinion);
        sb.append(", repoWareId=").append(repoWareId);
        sb.append(", rkState=").append(rkState);
        sb.append(", total=").append(total);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}